package cn.itcast.service;

import cn.itcast.dao.FakeDao;
import cn.itcast.dao.UserFeignClient;
import cn.itcast.pojo.User;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.DispatcherServlet;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: Saka
 * Date: 2019/1/9
 * Time: 15:52
 */
@Service
public class UserService {


    @Autowired
    private UserFeignClient userFeignClient;

    public List<User> queryUserByIds(List<Long> ids) {
        List<User> users = new ArrayList<>();



        ids.forEach(id->{
            users.add(userFeignClient.queryUserById(id));
        });
        return users;
    }

    public User queryUserByIdFb(Long id) {
        User user = new User();
        user.setId(id);
        user.setName("查询用户信息异常");
        return user;
    }

}
